﻿@{
    ViewBag.Title = "exploreList";
    Layout = null;
}

<link rel="stylesheet" type="text/css" href="~/Easy-UI/easyui/1.3.4/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="~/Easy-UI/css/wu.css" />
<link rel="stylesheet" type="text/css" href="~/Easy-UI/css/icon.css" />
<script type="text/javascript" src="~/Easy-UI/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="~/Easy-UI/easyui/1.3.4/jquery.easyui.min.js"></script>
<script type="text/javascript" src="~/Easy-UI/easyui/1.3.4/locale/easyui-lang-zh_CN.js"></script>

<style>
    th {
        text-align: right;
    }
</style>

<script>
    $(function () {
        $('#btn').bind('click', function () {
            alert('easyui');
        });
    });
</script>

<div style="padding:5px;background:#ccc;border:1px solid #ccc">
    <select class="easyui-combobox" name="city" style="width:156px;">
        <option value="0">所属部门</option>
        <option value="1">中关村管理部</option>
        <option value="2">昌平管理部</option>
        <option value="3">延庆管理部</option>
        <option value="4">门头沟管理部</option>
        <option value="5">密云管理部</option>
        <option value="6">怀柔管理部</option>
        <option value="7">雍和宫管理部</option>
        <option value="8">房山长阳管理部</option>
        <option value="9">房山燕山管理部</option>
    </select>
    <a href="#" class="easyui-linkbutton" plain="true" style="background:#fafafa;width:70px;height:24px;text-align:center">查询</a>
</div>

<div style="padding:5px;background:#ccc;border:1px solid #ccc">
    <a href="#" class="easyui-linkbutton" onclick="Location()" plain="true" style="background:#fafafa;width:90px;height:24px;text-align:center">区位状况勘察</a>
    <a href="#" class="easyui-linkbutton" onclick="Village()" plain="true" style="background:#fafafa;width:90px;height:24px;text-align:center">小区状况勘察</a>
    <a href="#" class="easyui-linkbutton" onclick="Floors()" plain="true" style="background:#fafafa;width:102px;height:24px;text-align:center">公共区域状况勘察</a>
    <a href="#" class="easyui-linkbutton" onclick="Indoor()" plain="true" style="background:#fafafa;width:90px;height:24px;text-align:center">室内状况勘察</a>
    <a href="#" class="easyui-linkbutton" onclick="Photo()" plain="true" style="background:#fafafa;width:90px;height:24px;text-align:center">现场照片提供</a>
    <a href="#" class="easyui-linkbutton" onclick="askPrice()" plain="true" style="background:#fafafa;width:70px;height:24px;text-align:center">询价记录</a>
    <a href="#" class="easyui-linkbutton" onclick="Details()" plain="true" style="background:#fafafa;width:70px;height:24px;text-align:center">详情</a>
    <a href="#" class="easyui-linkbutton" onclick="Auditing()" plain="true" style="background:#fafafa;width:70px;height:24px;text-align:center">审核详情</a>
</div>

<table id="tt" class="easyui-datagrid" style="height:auto;">
    <thead>
        <tr>
            <th checkbox="true"></th>
            <th field="name1" width="100">项目号</th>
            <th field="name2" width="120">所属部门</th>
            <th field="name3" width="100">联系人</th>
            <th field="name4" width="120">联系人电话</th>
            <th field="name5" width="120">房屋坐落</th>
            <th field="name6" width="120">登记日期</th>
            <th field="name7" width="120">项目状态</th>
            <th field="name8" width="80">操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var a in Model)
        {
            <tr>
                <td>@a.basic_id</td>
                <td><div style="background:#0094ff;color:#fafafa;text-align:center;">@a.projectNumber</div></td>
                <td>@a.department_Name</td>
                <td>@a.loan_Name</td>
                <td>@a.loan_TEL</td>
                <td>@a.house_Located</td>
                <td>@a.basic_CreateTime</td>
                @if (a.basic_State == 1)
                {
                    <td>待勘察</td>
                }
                @if (a.basic_State == 2)
                {
                    <td>勘察进项中</td>
                }
                @if (a.basic_State == 3)
                {
                    <td>已勘察</td>
                }

                @if (a.basic_State == 1)
                {
                    <td><input type="submit" value="勘察" onclick="start()" style="background:#ff0000;color:#fafafa;"></td>
                }
                @if (a.basic_State == 2)
                {
                    <td><input type="submit" value="勘察进项中" disabled style="background:#ff0000;color:#fafafa;"></td>
                }
                @if (a.basic_State == 3)
                {
                    <td><input type="submit" value="已勘察" disabled style="background:#ff0000;color:#fafafa;"></td>
                }
            </tr>
        }
    </tbody>
</table>
<div id="pp" class="easyui-pagination" style="background:#efefef;border:1px solid #ccc;"
     data-options="total:2000,pageSize:10">
</div>

<script>

    function start() {
        var id = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
        $.ajax({
            type: "post",
            url: "/House/startExplore",
            data: { projectNumber: id },
            success: function (result) {
                if (result == 1) {
                    alert("开始勘察!");
                }
            }
        })
    }

    //区位状况勘察
    function Location() {
        var checked = "";
        $(":checkbox:checked").each(function () {
            checked += $(":checkbox:checked").val() + ',';
        })
        checked = checked.substr(0, checked.length - 1);
        if (checked.length != 1) {
            alert("请选择一个项目进行勘察!");
        }
        else {
            var id = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
            //var id1 = $(":checkbox:checked").parent().html();
            //var id2 = $(":checkbox:checked").parent().parent().html();
            //var id3 = $(":checkbox:checked").parent().parent().parent().html();
            //var id4 = $(":checkbox:checked").parent().parent().parent().children().html();
            //var id5 = $(":checkbox:checked").parent().parent().parent().children().eq(1).html();
            //var id6 = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().html();
            //var id7 = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
            //alert(id1);
            //alert(id2);
            //alert(id3);
            //alert(id4);
            //alert(id5);
            //alert(id6);
            //alert(id7);

            parent.addTab("区位状况勘察", "/House/LocationAdd?id=" + id, "icon-chart-organisation", true);
        }
    }
    //小区状况勘察
    function Village() {
        var checked = "";
        $(":checkbox:checked").each(function () {
            checked += $(this).val() + ',';
        })
        checked = checked.substr(0, checked.length - 1);
        if (checked.length != 1) {
            alert("请选择一个项目进行勘察!");
        }
        else {
            var id = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
            parent.addTab("小区状况勘察", "/House/VillageAdd?id=" + id, "icon-chart-organisation", true);
        }
    }
    //公共区域状况勘察
    function Floors() {
        var checked = "";
        $(":checkbox:checked").each(function () {
            checked += $(this).val() + ',';
        })
        checked = checked.substr(0, checked.length - 1);
        if (checked.length != 1) {
            alert("请选择一个项目进行勘察!");
        }
        else {
            var id = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
            parent.addTab("公共区域状况勘察", "/House/FloorsAdd?id=" + id, "icon-chart-organisation", true);
        }
    }
    //室内状况勘察
    function Indoor() {
        var checked = "";
        $(":checkbox:checked").each(function () {
            checked += $(this).val() + ',';
        })
        checked = checked.substr(0, checked.length - 1);
        if (checked.length > 1) {
            alert("最多选择一个项目进行勘察!");
        }
        else {
            var id = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
            parent.addTab("室内状况勘察", "/House/IndoorAdd?id=" + id, "icon-chart-organisation", true);
        }
    }
    //现场照片上传
    function Photo() {
        var checked = "";
        $(":checkbox:checked").each(function () {
            checked += $(this).val() + ',';
        })
        checked = checked.substr(0, checked.length - 1);
        if (checked.length != 1) {
            alert("请选择一个项目进行勘察!");
        }
        else {
            var id = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
            parent.addTab("现场照片上传", "/House/PhotoAdd?id=" + id, "icon-chart-organisation", true);
        }
    }
    // 询价记录
    function askPrice() {
        var checked = "";
        $(":checkbox:checked").each(function () {
            checked += $(this).val() + ',';
        })
        checked = checked.substr(0, checked.length - 1);
        if (checked.length != 1) {
            alert("请选择一个项目进行查看!");
        }
        else {
            var id = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
            parent.addTab("询价记录", "/House/InquiryList?id=" + id, "icon-chart-organisation", true);
        }
    }
    //项目勘察详情
    function Details() {
        var checked = "";
        $(":checkbox:checked").each(function () {
            checked += $(this).val() + ',';
        })
        checked = checked.substr(0, checked.length - 1);
        if (checked.length != 1) {
            alert("请选择一个项目进行查看!");
        }
        else {
            var id = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
            var id1 = $(":checkbox:checked").parent();
            var id2 = $(":checkbox:checked").parent().parent();
            var id3 = $(":checkbox:checked").parent().parent().parent();
            var id4 = $(":checkbox:checked").parent().parent().parent().children();
            var id5 = $(":checkbox:checked").parent().parent().parent().children().eq(1);
            var id6 = $(":checkbox:checked").parent().parent().parent().children().eq(1).children();
            var id7 = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children();
            alert(id1);
            alert(id2);
            alert(id3);
            alert(id4);
            alert(id5);
            alert(id6);
            alert(id7);
            alert(id);
            parent.addTab("项目勘察详情", "/House/Details?id=" + id, "icon-chart-organisation", true);
        }
    }
    // 项目审核记录
    function Auditing() {
        var id = $(":checkbox:checked").parent().parent().parent().children().eq(1).children().children().html();
        parent.addTab("项目审核记录", "/House/exploreAuditingList", "icon-chart-organisation", true);
    }
</script>
